package yang.yu.sunny.utils;

import org.junit.Test;
import yang.yu.sunny.AbstractIntegrationTest;
import yang.yu.sunny.infra.elasticsearch.CustomerSearcher;
import yang.yu.sunny.infra.elasticsearch.ProductCategorySearcher;
import yang.yu.sunny.infra.elasticsearch.ProductSearcher;
import yang.yu.sunny.infra.persistence.product.ProductCategoryMapper;
import yang.yu.sunny.infra.persistence.product.ProductMapper;
import yang.yu.sunny.infra.persistence.sales.CustomerMapper;

import javax.inject.Inject;

/**
 * Created by yyang on 16/4/11.
 */
public class ElasticSearchUtils extends AbstractIntegrationTest {

    @Inject
    private ProductSearcher productSearcher;

    @Inject
    private ProductCategorySearcher categorySearcher;

    @Inject
    private CustomerSearcher customerSearcher;

    @Inject
    private ProductMapper productMapper;

    @Inject
    private ProductCategoryMapper categoryMapper;

    @Inject
    private CustomerMapper customerMapper;

    @Test
    public void init() {
        productMapper.listAll().forEach(productSearcher::create);
        categoryMapper.listAll().forEach(categorySearcher::create);
        customerMapper.listAll().forEach(customerSearcher::create);
    }
}
